package com.yxw.job.task.livevodbackend.fallback;

import com.yxw.live_vod_backend_facade.dto.AddVodUsageInformationDto;
import com.yxw.live_vod_backend_facade.feign.VodBackendFeignClient;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class VodBackendFallbackFactory implements FallbackFactory<VodBackendFeignClient> {


    @Override
    public VodBackendFeignClient create(Throwable cause) {
        return new VodBackendFeignClient() {
            @Override
            public BaseResult insertVodUsageInformationByDay(AddVodUsageInformationDto dto) {
                log.error(cause.getMessage());
                return new BaseResult<>("9999", "定时任务查询点播视频用量（天维度）失败：" + cause.getMessage());
            }
        };
    }
}
